package cn.edu.ctbu.myfirstweb.dao;

import cn.edu.ctbu.myfirstweb.domain.Course;
import cn.edu.ctbu.myfirstweb.domain.StudentScore;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.io.Serializable;
import java.util.List;

public interface StudentScoreEntityRepository extends JpaRepository<StudentScore, Long>,
        JpaSpecificationExecutor<StudentRepository>,
        Serializable {
    /**
     * 根据学生id查询他的课程成绩
     *
     * @param id
     * @return List<StudentScoreEntity>
     */
    @Query(nativeQuery = true, value = "select cid,cname,class1,credits,cproperty,csemester,score from tb_sc,tb_course where sid = :id and cid1 = cid and flag = 1")
    List<StudentScore> getScore(@Param("id") Long id);
}